﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Adams.Public.Web.Business.Web.Areas.Membership.Classifieds
{
    public class Index
    {
        public static Adams.Public.DataTransfer.Web.Areas.Membership.Classifieds.Index.PageLoad PageLoad(string token)
        {
            var input = new Adams.Public.DataTransfer.Classifieds.GetMemberPostingsInput() { 
                Token = token
            };
            var data = Api.GetData<Adams.Public.DataTransfer.Classifieds.GetMemberPostings>("Classifieds/GetMemberPostings", input);

            var model = new Adams.Public.DataTransfer.Web.Areas.Membership.Classifieds.Index.PageLoad();
            model.Postings = data.Postings;

            return model;
        }

        public static Adams.Public.DataTransfer.FormOutput Renew(Adams.Public.DataTransfer.Classifieds.RenewInput input)
        {
            var model = Api.GetData<Adams.Public.DataTransfer.FormOutput>("Classifieds/Renew", input);
            model.ID = input.PostingID.ToInt();
            return model;
        }

        public static Adams.Public.DataTransfer.FormOutput Remove(Adams.Public.DataTransfer.Classifieds.RemoveInput input)
        {
            var model = Api.GetData<Adams.Public.DataTransfer.FormOutput>("Classifieds/Remove", input);
            model.ID = input.PostingID.ToInt();
            return model;
        }
    }
}
